package a;

import java.util.Arrays;
import java.util.Scanner;

public class test_7 {

	public static void main(String[] args) {
		int n=0;
		int sum=1;
		int count=0;
		while(count<=9876) {
			n++;
			for(int i=1;i<=n;i++) {
				sum*=i;
			}
			count+=sum;
			sum=1;
		}
		System.out.println(n-1);
	}
}
